import '@css/adminPage.css'

import { addsellersApi } from '@utils/api/sellersManage'

document.querySelector('#sellersList').addEventListener('click', e => {
    location = `sellersManage.html`
})
document.querySelector('#addSellers').addEventListener('click', e => {
    location = `addSellersManage.html`
})

window.addEventListener('DOMContentLoaded', async () => {
    document.querySelector('#addSellersBtn').addEventListener('click', async () => {
        let sid = document.querySelector('#sid').value
        let sellersName = document.querySelector('#sellersName').value
        let sellersAccount = document.querySelector('#sellersAccount').value
        let sellersPassword = document.querySelector('#sellersPassword').value
        let sellers = { sid, sellersName, sellersAccount, sellersPassword }
        let seller = JSON.stringify(sellers)
        const { code, message, data } = await addsellersApi(seller)
        if (code) {
            alert(message)
        }

    })
})